package cn.wolfcode.crm.service.imp;

import cn.wolfcode.crm.domain.ProductStock;
import cn.wolfcode.crm.mapper.ProductStockMapper;
import cn.wolfcode.crm.query.PageResult;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IProductStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.Date;
import java.util.List;

@Service
public class ProductStockImpl implements IProductStockService {
    @Autowired
    private ProductStockMapper productStockMapper;

    @Override
    public PageResult query(QueryObject qo) {
        int total = productStockMapper.selectCount(qo);
        if(total==0){
            return new PageResult(total, Collections.EMPTY_LIST);
        }
        List<ProductStock> rows = productStockMapper.queryForList(qo);
        return new PageResult(total,rows);
    }

    @Override
    public Integer getLow() {
        return productStockMapper.getLow();
    }

}
